package com.ioc.demo.component;

import com.ioc.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2025-07-03
 * Time: 22:59
 */

@Controller
public class StudentComponent {
//    @Primary
    @Bean
    public Student s1(){
        return new Student("wyh",20);
    }

    @Bean
    public String name(){
        return "tjy";
    }

    @Bean
    public String name1(){
        return "wyh";
    }

//    @Primary
    @Bean
    public Student s2(String name){
        return new Student(name,19);
    }
}
